//
//  NSString+YGKCategory.m
//  PathTrack
//
//  Created by Jay on 16/7/8.
//  Copyright © 2016年 YGK. All rights reserved.
//

#import "NSString+YGKCategory.h"

@implementation NSString (YGKCategory)

+ (NSString*)dictionaryToJson:(NSDictionary *)dic
{
    NSError *parseError = nil;
    //NSJSONWritingPrettyPrinted  是有换位符的。如果NSJSONWritingPrettyPrinted 是nil 的话 返回的数据是没有 换位符的
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];
    NSString *jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    
    return jsonStr;
}

@end
